# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=jacktrip
pkgver=2.1.0
pkgrel=1
epoch=1
pkgdesc="Multi-machine audio network performance over the Internet"
arch=(loong64 x86_64)
url="https://github.com/jacktrip/jacktrip"
license=(
  LGPL-3.0-only
  GPL-2.0-or-later
  GPL-3.0-or-later
  MIT
)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  qt6-5compat
  qt6-base
  qt6-declarative
  qt6-networkauth
  qt6-quickcontrols2
  qt6-shadertools
  qt6-svg
  qt6-webchannel
  qt6-webengine
  qt6-websockets
)
makedepends=(
  help2man
  meson
  jack
  python-jinja
  python-yaml
  rtaudio
)
source=($url/archive/v$pkgver/$pkgname-v$pkgver.tar.gz)
sha512sums=('97d9b12a283a7b0dadf8161fbff1a39ad769cef62967b283c5e1afd6102e37f0afa430436047693aec3dc9f6dbb6835d43f30e57fe0496c2c3e6047d58cbff97')
b2sums=('43d62bc8edab47b35a7703a1581b5d4773965ea0d807335175482a3ae6a375c54cada876a50d162aa7a02d8d457f37be919708b2036748e2d5450ab3e966498c')

build() {
  local meson_options=(
    -D noupdater=true
  )

  arch-meson "${meson_options[@]}" build $pkgname-$pkgver
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  depends+=(
    jack libjack.so
    rtaudio librtaudio.so
  )

  DESTDIR="$pkgdir" meson install -C build
  install -vDm 644 $pkgname-$pkgver/{LICENSE.md,LICENSES/MIT.txt} -t "$pkgdir/usr/share/licenses/$pkgname"
  install -vDm 644 $pkgname-$pkgver/README.md -t "$pkgdir/usr/share/doc/$pkgname"
}
